/*
 *  Value.h
 *  OfflineTranslator
 *
 *  Created by PH on 5.9.10.
 *  Copyright 2010 Petr Homola. All rights reserved.
 *
 */

#ifndef NLP_VALUE_H_
#define NLP_VALUE_H_

#include "global.h"
#include <string>
#include <iostream>
#ifdef TR1
#include <tr1/memory>
#include <tr1/functional>
#else
#include <memory>
#include <functional>
#endif

namespace nlp {

	using namespace std;
#ifdef TR1
	using namespace std::tr1;
#endif
	
	class AVM;
	
	class Value {
		
		private:
		string _string;
		shared_ptr<AVM> avm;
		//bool empty;
		//mutable bool ownsAvm;

		public:
		Value() {
			//avm = NULL;
			//empty = true;
		}
		
		bool isEmpty() const {
			return _string.size() == 0 && avm == NULL;
			//return empty;
		}
        
        bool isString() const { return _string.size() > 0; }
		
		Value(const Value& value);
		
		Value(const char* s) {
			_string = s;
			//avm = NULL;
			//empty = false;
			//cout << "1-" << _string << endl;
		}
		
		Value(string s) {
			_string = s;
			//avm = NULL;
			//empty = false;
			//cout << "1-" << _string << endl;
		}
		
		Value(shared_ptr<AVM> _avm);
		
		~Value();
		
		/*Value& operator=(const Value& other) {
			return *this;
		}*/
		
		string getString() const { return _string; }
		
		shared_ptr<AVM> getAvm() const { return avm; }
		
		string description() const { return _string; }

		string description() { return _string; }
		
		bool equals(const Value& v) const;
		
	};

}

#endif
